

add_definitions(-DCE_DLL_EXPORT)
add_definitions(-D_USE_MATH_DEFINES)


include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(
	CE_SOURCES
	engine.cpp
	engine.h
	export.h
	ifile.h
	iobject.h
	iviewport.h
	iwindow.h
	manager.h
	sharedvalue.cpp
	sharedvalue.h
	sharedvaluemanager.cpp
	sharedvaluemanager.h
	sdlwindow.cpp
	sdlwindow.h
	vfs.cpp
	vfs.h
	)

set(
	CE_ASSET_SOURCES
	asset/asset.cpp
	asset/asset.h
	asset/assetlocator.cpp
	asset/assetlocator.h
	asset/assetreader.h
	asset/assetsystem.cpp
	asset/assetsystem.h
	)

set(
	CE_ASSET_READER_SOURCES
	asset/reader/assetreadereffect.cpp
	asset/reader/assetreadereffect.h
	asset/reader/assetreaderimage.cpp
	asset/reader/assetreaderimage.h
	asset/reader/assetreaderlevelofdetailsolver.cpp
	asset/reader/assetreaderlevelofdetailsolver.h
	asset/reader/assetreadermaterial.cpp
	asset/reader/assetreadermaterial.h
	asset/reader/assetreadermesh.cpp
	asset/reader/assetreadermesh.h
	asset/reader/assetreaderprogram.cpp
	asset/reader/assetreaderprogram.h
	asset/reader/assetreaderscenenode.cpp
	asset/reader/assetreaderscenenode.h
	asset/reader/assetreadershader.cpp
	asset/reader/assetreadershader.h
	asset/reader/assetreadertexture.cpp
	asset/reader/assetreadertexture.h
	)

set(
	CE_FS_SOURCES
	fs/fileinfo.cpp
	fs/fileinfo.h
	fs/filestd.cpp
	fs/filestd.h
	)

set(
	CE_GFX_SOURCES
	gfx/camera.cpp
	gfx/camera.h
	gfx/capabilities.h
	gfx/enum.h
	gfx/ibillboardmesh.h
	gfx/idevice.h
	gfx/ieffect.h
	gfx/ieffecttechnique.h
	gfx/iindexbuffer.h
	gfx/iinstancedmesh.h
	gfx/image.cpp
	gfx/image.h
	gfx/imesh.h
	gfx/imorphmesh.h
	gfx/ipatchmesh.h
	gfx/iprogram.h
	gfx/irendertarget.h
	gfx/ishader.h
	gfx/iskinmesh.h
	gfx/istaticmesh.h
	gfx/itexture.h
	gfx/ivertexbuffer.h
	gfx/ivertexdeclaration.h
	gfx/levelofdetail.h
	gfx/light.cpp
	gfx/light.h
	gfx/material.cpp
	gfx/material.h
	gfx/mesh.cpp
	gfx/mesh.h
	gfx/multimesh.cpp
	gfx/multimesh.h
	gfx/programparametername.cpp
	gfx/programparametername.h
	gfx/projector.cpp
	gfx/projector.h
	gfx/renderenvironment.h
	gfx/sharedshaderbinding.h
	gfx/sharedshaderbinding.cpp
	gfx/texturepack.cpp
	gfx/texturepack.h
	gfx/vertex.h
	)

set(
	CE_GFX_GENERATOR_SOURCES
	gfx/generator/grassinstancegenerator.cpp
	gfx/generator/grassinstancegenerator.h
	)


set(
	CE_GFX_GL20_SOURCES
	gfx/gl20/device.cpp
	gfx/gl20/device.h
	gfx/gl20/effect_gl20.cpp
	gfx/gl20/effect_gl20.h
	gfx/gl20/effecttechnique_gl20.cpp
	gfx/gl20/effecttechnique_gl20.h
	gfx/gl20/glchecker.h
	gfx/gl20/indexbuffer_gl15.cpp
	gfx/gl20/indexbuffer_gl15.h
	gfx/gl20/program_gl20.cpp
	gfx/gl20/program_gl20.h
	gfx/gl20/programparameter_gl20.cpp
	gfx/gl20/programparameter_gl20.h
	gfx/gl20/renderloop.cpp
	gfx/gl20/renderloop.h
	gfx/gl20/rendertargetfbo.cpp
	gfx/gl20/rendertargetfbo.h
	gfx/gl20/shader_gl20.cpp
	gfx/gl20/shader_gl20.h
	gfx/gl20/texture.cpp
	gfx/gl20/texture.h
	gfx/gl20/vertexbuffer_gl15.cpp
	gfx/gl20/vertexbuffer_gl15.h
	gfx/gl20/vertexdeclaration_gl13.cpp
	gfx/gl20/vertexdeclaration_gl13.h
	)

set(
	CE_GFX_GL20_MESH_SOURCES
	gfx/gl20/mesh/billboardmesh.cpp
	gfx/gl20/mesh/billboardmesh.h
	gfx/gl20/mesh/instancedmesh.cpp
	gfx/gl20/mesh/instancedmesh.h
	gfx/gl20/mesh/instancedmeshgpu.cpp
	gfx/gl20/mesh/instancedmeshgpu.h
	gfx/gl20/mesh/instancedmeshsw.cpp
	gfx/gl20/mesh/instancedmeshsw.h
	gfx/gl20/mesh/morphmesh.cpp
	gfx/gl20/mesh/morphmesh.h
	gfx/gl20/mesh/patchmesh.cpp
	gfx/gl20/mesh/patchmesh.h
	gfx/gl20/mesh/skinmeshgpu.cpp
	gfx/gl20/mesh/skinmeshgpu.h
	gfx/gl20/mesh/staticmesh.cpp
	gfx/gl20/mesh/staticmesh.h
	)



set(
	CE_MANAGER_SOURCES
	manager/materialmanager.cpp
	manager/materialmanager.h
	manager/meshmanager.cpp
	manager/meshmanager.h
	manager/solvermanager.cpp
	manager/solvermanager.h
	)

set(
	CE_MATH_SOURCES
	math/boundingbox.cpp
	math/boundingbox.h
	math/color.h
	math/matrix.h
	math/plane.cpp
	math/plane.h
	math/quaternion.h
	math/ray.h
	math/rect.h
	math/sphere.cpp
	math/sphere.h
	math/vector.h
	)

set(
	CE_SCENE_SOURCES
	scene/billboardanimator.cpp
	scene/billboardanimator.h
	scene/clipper.cpp
	scene/clipper.h
	scene/enum.h
	scene/entitynode.cpp
	scene/entitynode.h
	scene/geometry.cpp
	scene/geometry.h
	scene/ianimator.h
	scene/ieffectcamera.h
	scene/impostereffectcamera.cpp
	scene/impostereffectcamera.h
	scene/itransformationcallback.h
	scene/light.cpp
	scene/light.h
	scene/lodnode.cpp
	scene/lodnode.h
	scene/managedlight.cpp
	scene/managedlight.h
	scene/node.cpp
	scene/node.h
	scene/portal.cpp
	scene/portal.h
	scene/renderbucket.cpp
	scene/renderbucket.h
	scene/scene.cpp
	scene/scene.h
	scene/sector.cpp
	scene/sector.h
	scene/skeleton.cpp
	scene/skeleton.h
	scene/skeletonbone.cpp
	scene/skeletonbone.h
	scene/sky.cpp
	scene/sky.h
	scene/terraformer.cpp
	scene/terraformer.h
	)

set(
	CE_TINY_XML_SOURCES
	tinyxml/tinystr.cpp
	tinyxml/tinystr.h
	tinyxml/tinyxml.cpp
	tinyxml/tinyxml.h
	tinyxml/tinyxmlerror.cpp
	tinyxml/tinyxmlparser.cpp
	tinyxml/xmlreader.cpp
	tinyxml/xmlreader.h
	)

set(
	CE_UTILS_SOURCES
	utils/boundingboxbuilder.cpp
	utils/boundingboxbuilder.h
	utils/cameraprojectorsetup.cpp
	utils/cameraprojectorsetup.h
	utils/lodgenerator.cpp
	utils/lodgenerator.h
	utils/meshcreator.cpp
	utils/meshcreator.h
	utils/nodescanner.cpp
	utils/nodescanner.h
	utils/transformer.cpp
	utils/transformer.h
	utils/utils.h
	)


source_group(
	"CrimsonEngine"
	FILES
	${CE_SOURCES}
	)

source_group(
	"CrimsonEngine\\asset"
	FILES
	${CE_ASSET_SOURCES}
	)

source_group(
	"CrimsonEngine\\asset\\reader"
	FILES
	${CE_ASSET_READER_SOURCES}
	)

source_group(
	"CrimsonEngine\\fs"
	FILES
	${CE_FS_SOURCES}
	)

source_group(
	"CrimsonEngine\\gfx"
	FILES
	${CE_GFX_SOURCES}
	)

source_group(
	"CrimsonEngine\\cg"
	FILES
	${CE_GFX_CG_SOURCES}
	)

source_group(
	"CrimsonEngine\\gfx\\generator"
	FILES
	${CE_GFX_GENERATOR_SOURCES}
	)

source_group(
	"CrimsonEngine\\gfx\\gl20"
	FILES
	${CE_GFX_GL20_SOURCES}
	)


source_group(
	"CrimsonEngine\\gfx\\gl20\\mesh"
	FILES
	${CE_GFX_GL20_MESH_SOURCES}
	)


source_group(
	"CrimsonEngine\\manager"
	FILES
	${CE_MANAGER_SOURCES}
	)

source_group(
	"CrimsonEngine\\math"
	FILES
	${CE_MATH_SOURCES}
	)


source_group(
	"CrimsonEngine\\scene"
	FILES
	${CE_SCENE_SOURCES}
	)

source_group(
	"CrimsonEngine\\tinyxml"
	FILES
	${CE_TINY_XML_SOURCES}
	)

source_group(
	"CrimsonEngine\\utils"
	FILES
	${CE_UTILS_SOURCES}
	)

add_library(
	CrimsonEngine SHARED
	${CE_SOURCES}
	${CE_ASSET_SOURCES}
	${CE_ASSET_READER_SOURCES}
	${CE_FS_SOURCES}
	${CE_GFX_SOURCES}
	${CE_GFX_CG_SOURCES}
	${CE_GFX_GENERATOR_SOURCES}
	${CE_GFX_GL20_SOURCES}
	${CE_GFX_GL20_MESH_SOURCES}
	${CE_MATH_SOURCES}
	${CE_MANAGER_SOURCES}
	${CE_SCENE_SOURCES}
	${CE_TINY_XML_SOURCES}
	${CE_UTILS_SOURCES}
	)


target_link_libraries(
	CrimsonEngine
	CrimsonFileFormat
	${GLEW_LIBRARIES}
	${IL_LIBRARIES}
	${ILU_LIBRARIES}
	${OIS_LIBRARIES}
	${OPENGL_LIBRARIES}
	${SDL_LIBRARY}
	)
        
